import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: '/ssoLogin',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/login',
    component: () => import('@/views/commonLogin/index'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    meta: { title: '首页', icon: 'dashboard' },
    children: [
      {
        path: 'dashboard',
        name: '首页',
        component: () => import('@/views/dashboard/index'),
        meta: { title: '首页', icon: 'dashboard' }
      },
      // {
      //   path: 'workplan',
      //   name: '工作计划',
      //   component: () => import('@/views/dashboard/workplan/index'),
      //   meta: { title: '工作计划', icon: 'dashboard' }
      // },
      // {
      //   path: 'infocheck',
      //   name: '信息查看',
      //   component: () => import('@/views/dashboard/infocheck/index'),
      //   meta: { title: '信息查看', icon: 'dashboard' }
      // },
      // {
      //   path: 'getinfo',
      //   name: '接收消息',
      //   component: () => import('@/views/dashboard/getinfo/index'),
      //   meta: { title: '接收消息', icon: 'dashboard' }
      // },
      // {
      //   path: 'sendinfo',
      //   name: '发送消息',
      //   component: () => import('@/views/dashboard/sendinfo/index'),
      //   meta: { title: '发送消息', icon: 'dashboard' }
      // },
      // {
      //   path: 'contacts',
      //   name: '通讯录查看',
      //   component: () => import('@/views/dashboard/contacts/index'),
      //   meta: { title: '通讯录查看', icon: 'dashboard' }
      // },
      {
        path: 'PersonalData',
        name: '个人资料',
        component: () => import('@/views/dashboard/PersonalData/index'),
        meta: { title: '个人资料', icon: 'dashboard' }
      },
      // {
      //   path: 'scientific',
      //   name: '科研详情',
      //   component: () => import('@/views/dashboard/scientific/index'),
      //   meta: { title: '科研详情', icon: 'dashboard' }
      // },
      {
        path: 'changepassword',
        name: '修改密码',
        component: () => import('@/views/dashboard/changepassword/index'),
        meta: { title: '修改密码', icon: 'dashboard' }
      }
      // {
      //   path: 'MessageBoard',
      //   name: '商业合作留言板',
      //   component: () => import('@/views/dashboard/MessageBoard/index'),
      //   meta: { title: '商业合作留言板', icon: 'dashboard' }
      // }
    ]
  }
]

export const asyncRoutes = [
  {
    path: '/project',
    component: Layout,
    redirect: '/project/my_vertical',
    name: '项目管理',
    meta: {
      title: '项目管理',
      icon: 'nested',
      roles: ['院级教师', '校级审核员', '院级审核员']
    },
    children: [
      {
        path: 'industry_university_park',
        component: () => import('@/views/project/industry_university_park/index'),
        redirect: 'noRedirect',
        name: '产学合作协同育人项目',
        meta: { title: '产学合作协同育人项目', icon: 'nested', roles: ['院级教师', '校级审核员', '院级审核员'] },
        children: [
          {
            path: 'horizontal',
            component: () => import('@/views/project/industry_university_park/horizontal/index'),
            name: '产学合作协同育人项目（横向）',
            meta: { title: '产学合作协同育人项目（横向）', icon: 'nested' }
          },
          {
            path: 'vertical',
            component: () => import('@/views/project/industry_university_park/vertical/index'),
            name: '产学合作协同育人项目（纵向）',
            meta: { title: '产学合作协同育人项目（纵向）', icon: 'nested' }
          }
        ]
      },
      {
        path: 'industry_university_park_check',
        component: () => import('@/views/project/industry_university_park_check/index'),
        redirect: 'noRedirect',
        name: '产学合作协同育人项目审核',
        meta: { title: '产学合作协同育人项目审核', icon: 'nested', roles: ['校级审核员', '院级审核员'] },
        children: [
          {
            path: 'horizontal_check',
            component: () => import('@/views/project/industry_university_park_check/horizontal_check/index'),
            name: '横向审核',
            meta: { title: '横向审核', icon: 'nested', roles: ['校级审核员', '院级审核员'] },
            children: [
              {
                path: 'constructing_check',
                component: () => import('@/views/project/industry_university_park_check/horizontal_check/constructing_check/index'),
                name: '产学合作协同育人项目（横向）在研审核',
                meta: { title: '在研审核', icon: 'nested', roles: ['校级审核员'] }
              },
              {
                path: 'constructing_check',
                component: () => import('@/views/project/industry_university_park_check/horizontal_check/constructing_check/index2'),
                name: '产学合作协同育人项目（横向）在研审核',
                meta: { title: '在研审核', icon: 'nested', roles: ['院级审核员'] }
              },
              {
                path: 'conclusion_check',
                component: () => import('@/views/project/industry_university_park_check/horizontal_check/conclusion_check/index'),
                name: '产学合作协同育人项目（横向）结题审核',
                meta: { title: '结题审核', icon: 'nested', roles: ['校级审核员'] }
              },
              {
                path: 'conclusion_check',
                component: () => import('@/views/project/industry_university_park_check/horizontal_check/conclusion_check/index2'),
                name: '产学合作协同育人项目（横向）结题审核',
                meta: { title: '结题审核', icon: 'nested', roles: ['院级审核员'] }
              }
            ]
          },
          {
            path: 'vertical_check',
            component: () => import('@/views/project/industry_university_park_check/vertical_check/index'),
            name: '纵向审核',
            meta: { title: '纵向审核', icon: 'nested', roles: ['校级审核员', '院级审核员'] },
            children: [
              {
                path: 'constructing_check',
                component: () => import('@/views/project/industry_university_park_check/vertical_check/constructing_check/index'),
                name: '产学合作协同育人项目（纵向）在研审核',
                meta: { title: '在研审核', icon: 'nested', roles: ['校级审核员'] }
              },
              {
                path: 'constructing_check',
                component: () => import('@/views/project/industry_university_park_check/vertical_check/constructing_check/index2'),
                name: '产学合作协同育人项目（纵向）在研审核',
                meta: { title: '在研审核', icon: 'nested', roles: ['院级审核员'] }
              },
              {
                path: 'conclusion_check',
                component: () => import('@/views/project/industry_university_park_check/vertical_check/conclusion_check/index'),
                name: '产学合作协同育人项目（纵向）结题审核',
                meta: { title: '结题审核', icon: 'nested', roles: ['校级审核员'] }
              },
              {
                path: 'conclusion_check',
                component: () => import('@/views/project/industry_university_park_check/vertical_check/conclusion_check/index2'),
                name: '产学合作协同育人项目（纵向）结题审核',
                meta: { title: '结题审核', icon: 'nested', roles: ['院级审核员'] }
              }
            ]
          }
        ]
      },
      {
        path: 'my_vertical',
        component: () => import('@/views/project/my_vertical/index'),
        name: '我的纵向项目',
        meta: { title: '纵向项目', icon: 'nested', roles: ['院级教师', '校级审核员', '院级审核员'] }
      },
      {
        path: 'vertical_check',
        component: () => import('@/views/project/vertical_check/index'),
        redirect: 'noRedirect',
        name: '纵向项目审核',
        meta: { title: '纵向项目审核', icon: 'nested', roles: ['校级审核员', '院级审核员'] },
        children: [
          {
            path: 'constructing_check',
            component: () => import('@/views/project/vertical_check/constructing_check/index'),
            name: '纵向在研项目-审核',
            meta: { title: '在研项目-审核', icon: 'nested', roles: ['校级审核员'] }
          },
          {
            path: 'constructing_check',
            component: () => import('@/views/project/vertical_check/constructing_check/index2'),
            name: '纵向在研项目-审核',
            meta: { title: '在研项目-审核', icon: 'nested', roles: ['院级审核员'] }
          },
          {
            path: 'conclusion_check',
            component: () => import('@/views/project/vertical_check/conclusion_check/index'),
            name: '纵向结题项目-审核',
            meta: { title: '结题项目-审核', icon: 'nested', roles: ['校级审核员'] }
          },
          {
            path: 'conclusion_check',
            component: () => import('@/views/project/vertical_check/conclusion_check/index2'),
            name: '纵向结题项目-审核',
            meta: { title: '结题项目-审核', icon: 'nested', roles: ['院级审核员'] }
          }
        ]
      },
      {
        path: 'my_horizontal',
        component: () => import('@/views/project/my_horizontal/index'),
        name: '我的横向项目',
        meta: { title: '横向项目', icon: 'nested', roles: ['院级教师', '校级审核员', '院级审核员'] }
      },
      {
        path: 'horizontal_check',
        component: () => import('@/views/project/horizontal_check/index'),
        redirect: 'noRedirect',
        name: '横向项目审核',
        meta: { title: '横向项目审核', icon: 'nested', roles: ['校级审核员', '院级审核员'] },
        children: [
          {
            path: 'constructing_check',
            component: () => import('@/views/project/horizontal_check/constructing_check/index'),
            name: '横向在研项目-审核',
            meta: { title: '在研项目-审核', icon: 'nested', roles: ['校级审核员'] }
          },
          {
            path: 'constructing_check',
            component: () => import('@/views/project/horizontal_check/constructing_check/index2'),
            name: '横向在研项目-审核',
            meta: { title: '在研项目-审核', icon: 'nested', roles: ['院级审核员'] }
          },
          {
            path: 'conclusion_check',
            component: () => import('@/views/project/horizontal_check/conclusion_check/index'),
            name: '横向结题项目-审核',
            meta: { title: '结题项目-审核', icon: 'nested', roles: ['校级审核员'] }
          },
          {
            path: 'conclusion_check',
            component: () => import('@/views/project/horizontal_check/conclusion_check/index2'),
            name: '横向结题项目-审核',
            meta: { title: '结题项目-审核', icon: 'nested', roles: ['院级审核员'] }
          }
        ]
      }
    ]
  },
  // {
  //   path: '/funds_management',
  //   component: Layout,
  //   redirect: '/funds_management/project_funding',
  //   name: '经费管理',
  //   meta: {
  //     title: '经费管理',
  //     icon: 'nested'
  //   },
  //   children: [
  //     {
  //       path: 'project_funding',
  //       component: () => import('@/views/funds_management/project_funding/index'),
  //       name: '项目经费情况表',
  //       meta: { title: '项目经费情况表', icon: 'nested' }
  //     },
  //     {
  //       path: 'funds_arrived',
  //       component: () => import('@/views/funds_management/funds_arrived/index'),
  //       name: '经费到账明细',
  //       meta: { title: '经费到账明细', icon: 'nested', roles: ['隐藏'] }
  //     },
  //     {
  //       path: 'expenditures',
  //       component: () => import('@/views/funds_management/expenditures/index'),
  //       redirect: 'noRedirect',
  //       name: '经费支出',
  //       meta: { title: '经费支出', icon: 'nested', roles: ['隐藏'] },
  //       children: [
  //         {
  //           path: 'expenditures_view',
  //           component: () => import('@/views/funds_management/expenditures/expenditures_view/index'),
  //           name: '支出明细列表',
  //           meta: { title: '支出明细列表', icon: 'nested' }
  //         },
  //         {
  //           path: 'expenditures_check',
  //           component: () => import('@/views/funds_management/expenditures/expenditures_check/index'),
  //           name: '支出审核',
  //           meta: { title: '支出审核', icon: 'nested' }
  //         }
  //       ]
  //     },
  //     {
  //       path: 'allocation_funds',
  //       component: () => import('@/views/funds_management/allocation_funds/index'),
  //       redirect: 'noRedirect',
  //       name: '经费划拨',
  //       meta: { title: '经费划拨', icon: 'nested', roles: ['隐藏'] },
  //       children: [
  //         {
  //           path: 'allocation_funds_view',
  //           component: () => import('@/views/funds_management/allocation_funds/allocation_funds_view/index'),
  //           name: '划拨明细列表',
  //           meta: { title: '划拨明细列表', icon: 'nested' }
  //         },
  //         {
  //           path: 'allocation_funds_check',
  //           component: () => import('@/views/funds_management/allocation_funds/allocation_funds_check/index'),
  //           name: '划拨审核',
  //           meta: { title: '划拨审核', icon: 'nested' }
  //         }
  //       ]
  //     }
  //   ]
  // },
  {
    path: '/results_management',
    component: Layout,
    redirect: '/results_management/thesis_management/thesis_view',
    name: '成果模块',
    meta: {
      title: '成果模块',
      icon: 'nested'
    },
    children: [
      {
        path: 'thesis_management',
        component: () => import('@/views/results_management/thesis_management/index'),
        redirect: 'noRedirect',
        name: '论文管理',
        meta: { title: '论文管理', icon: 'nested' },
        children: [
          {
            path: 'thesis_view',
            component: () => import('@/views/results_management/thesis_management/thesis_view/index'),
            name: '论文',
            meta: { title: '论文', icon: 'nested', roles: ['院级教师', '院级审核员', '校级审核员'] }
          },
          {
            path: 'thesis_check1',
            component: () => import('@/views/results_management/thesis_management/thesis_check1/index'),
            name: '论文审核-院级',
            meta: { title: '论文审核-院级', icon: 'nested', roles: ['院级审核员'] }
          },
          {
            path: 'thesis_check2',
            component: () => import('@/views/results_management/thesis_management/thesis_check2/index'),
            name: '论文审核-校级',
            meta: { title: '论文审核-校级', icon: 'nested', roles: ['校级审核员'] }
          }
        ]
      },
      {
        path: 'work_management',
        component: () => import('@/views/results_management/work_management/index'),
        redirect: 'noRedirect',
        name: '著作管理',
        meta: { title: '著作管理', icon: 'nested' },
        children: [
          {
            path: 'work_view',
            component: () => import('@/views/results_management/work_management/work_view/index'),
            name: '著作',
            meta: { title: '著作', icon: 'nested', roles: ['院级教师', '院级审核员', '校级审核员'] }
          },
          {
            path: 'work_check1',
            component: () => import('@/views/results_management/work_management/work_check1/index'),
            name: '著作审核-院级',
            meta: { title: '著作审核-院级', icon: 'nested', roles: ['院级审核员'] }
          },
          {
            path: 'work_check2',
            component: () => import('@/views/results_management/work_management/work_check2/index'),
            name: '著作审核-校级',
            meta: { title: '著作审核-校级', icon: 'nested', roles: ['校级审核员'] }
          }
        ]
      },
      {
        path: 'patent_management',
        component: () => import('@/views/results_management/patent_management/index'),
        redirect: 'noRedirect',
        name: '专利管理',
        meta: { title: '专利管理', icon: 'nested' },
        children: [
          {
            path: 'patent_view',
            component: () => import('@/views/results_management/patent_management/patent_view/index'),
            name: '专利',
            meta: { title: '专利', icon: 'nested', roles: ['院级教师', '院级审核员', '校级审核员'] }
          },
          {
            path: 'patent_check1',
            component: () => import('@/views/results_management/patent_management/patent_check1/index'),
            name: '专利审核-院级',
            meta: { title: '专利审核-院级', icon: 'nested', roles: ['院级审核员'] }
          },
          {
            path: 'patent_check2',
            component: () => import('@/views/results_management/patent_management/patent_check2/index'),
            name: '专利审核-校级',
            meta: { title: '专利审核-校级', icon: 'nested', roles: ['校级审核员'] }
          }
        ]
      },
      {
        path: 'result_management',
        component: () => import('@/views/results_management/result_management/index'),
        redirect: 'noRedirect',
        name: '奖励管理',
        meta: { title: '奖励管理', icon: 'nested' },
        children: [
          {
            path: 'result_view',
            component: () => import('@/views/results_management/result_management/result_view/index'),
            name: '奖励',
            meta: { title: '奖励', icon: 'nested', roles: ['院级教师', '院级审核员', '校级审核员'] }
          },
          {
            path: 'result_check1',
            component: () => import('@/views/results_management/result_management/result_check1/index'),
            name: '奖励审核-院级',
            meta: { title: '奖励审核-院级', icon: 'nested', roles: ['院级审核员'] }
          },
          {
            path: 'result_check2',
            component: () => import('@/views/results_management/result_management/result_check2/index'),
            name: '奖励审核-校级',
            meta: { title: '奖励审核-校级', icon: 'nested', roles: ['校级审核员'] }
          }
        ]
      },
      {
        path: 'art_management',
        component: () => import('@/views/results_management/art_management/index'),
        redirect: 'noRedirect',
        name: '艺体类成果管理',
        meta: { title: '艺体类成果', icon: 'nested' },
        children: [
          {
            path: 'art_view',
            component: () => import('@/views/results_management/art_management/art_view/index'),
            name: '艺体类成果',
            meta: { title: '艺体类成果', icon: 'nested', roles: ['院级教师', '院级审核员', '校级审核员'] }
          },
          {
            path: 'art_check1',
            component: () => import('@/views/results_management/art_management/art_check1/index'),
            name: '艺体类审核-院级',
            meta: { title: '艺体类审核-院级', icon: 'nested', roles: ['院级审核员'] }
          },
          {
            path: 'art_check2',
            component: () => import('@/views/results_management/art_management/art_check2/index'),
            name: '艺体类审核-校级',
            meta: { title: '艺体类审核-校级', icon: 'nested', roles: ['校级审核员'] }
          }
        ]
      },
      {
        path: 'consult_management',
        component: () => import('@/views/results_management/consult_management/index'),
        redirect: 'noRedirect',
        name: '咨询报告管理',
        meta: { title: '咨询报告', icon: 'nested' },
        children: [
          {
            path: 'consult_view',
            component: () => import('@/views/results_management/consult_management/consult_view/index'),
            name: '咨询报告',
            meta: { title: '咨询报告', icon: 'nested', roles: ['院级教师', '院级审核员', '校级审核员'] }
          },
          {
            path: 'consult_view1',
            component: () => import('@/views/results_management/consult_management/consult_check1/index'),
            name: '咨询报告审核-院级',
            meta: { title: '咨询报告审核-院级', icon: 'nested', roles: ['院级审核员'] }
          },
          {
            path: 'consult_view2',
            component: () => import('@/views/results_management/consult_management/consult_check2/index'),
            name: '咨询报告审核-校级',
            meta: { title: '咨询报告审核-校级', icon: 'nested', roles: ['校级审核员'] }
          }
        ]
      },
      {
        path: 'identify_management',
        component: () => import('@/views/results_management/identify_management/index'),
        redirect: 'noRedirect',
        name: '成果鉴定管理',
        meta: { title: '成果鉴定管理', icon: 'nested', roles: ['隐藏'] },
        children: [
          {
            path: 'identify_view',
            component: () => import('@/views/results_management/identify_management/identify_view/index'),
            name: '我的成果鉴定',
            meta: { title: '我的成果鉴定', icon: 'nested', roles: ['院级教师'] }
          },
          {
            path: 'identify_check1',
            component: () => import('@/views/results_management/identify_management/identify_check1/index'),
            name: '审核-院级',
            meta: { title: '成果鉴定审核-院级', icon: 'nested', roles: ['院级审核员'] }
          },
          {
            path: 'identify_check2',
            component: () => import('@/views/results_management/identify_management/identify_check2/index'),
            name: '成果鉴定审核-校级',
            meta: { title: '成果鉴定审核-校级', icon: 'nested', roles: ['校级审核员'] }
          }
        ]
      }
    ]
  },
  // {
  //   path: '/academic_activities',
  //   component: Layout,
  //   redirect: '/academic_activities/host_conference/host_conference_view',
  //   name: '学术活动',
  //   meta: {
  //     title: '学术活动',
  //     icon: 'nested',
  //     roles: ['院级教师', '校级审核员']
  //   },
  //   children: [
  //     {
  //       path: 'host_conference',
  //       component: () => import('@/views/academic_activities/host_conference/index'),
  //       redirect: 'noRedirect',
  //       name: '主办会议',
  //       meta: { title: '主办会议', icon: 'nested' },
  //       children: [
  //         {
  //           path: 'host_conference_view',
  //           component: () => import('@/views/academic_activities/host_conference/host_conference_view/index'),
  //           name: '主办会议管理',
  //           meta: { title: '主办会议管理', icon: 'nested', roles: ['院级教师'] }
  //         },
  //         {
  //           path: 'host_conference_check',
  //           component: () => import('@/views/academic_activities/host_conference/host_conference_check/index'),
  //           name: '主办会议审核',
  //           meta: { title: '主办会议审核', icon: 'nested', roles: ['校级审核员'] }
  //         }
  //       ]
  //     },
  //     {
  //       path: 'attend_meetings',
  //       component: () => import('@/views/academic_activities/attend_meetings/index'),
  //       redirect: 'noRedirect',
  //       name: '参加会议',
  //       meta: { title: '参加会议', icon: 'nested' },
  //       children: [
  //         {
  //           path: 'attend_meetings_view',
  //           component: () => import('@/views/academic_activities/attend_meetings/attend_meetings_view/index'),
  //           name: '参加会议管理',
  //           meta: { title: '参加会议管理', icon: 'nested', roles: ['院级教师'] }
  //         },
  //         {
  //           path: 'attend_meetings_check',
  //           component: () => import('@/views/academic_activities/attend_meetings/attend_meetings_check/index'),
  //           name: '参加会议审核',
  //           meta: { title: '参加会议审核', icon: 'nested', roles: ['校级审核员'] }
  //         }
  //       ]
  //     },
  //     {
  //       path: 'academic_lectures',
  //       component: () => import('@/views/academic_activities/academic_lectures/index'),
  //       redirect: 'noRedirect',
  //       name: '学术讲座',
  //       meta: { title: '学术讲座', icon: 'nested' },
  //       children: [
  //         {
  //           path: 'academic_lectures_view',
  //           component: () => import('@/views/academic_activities/academic_lectures/academic_lectures_view/index'),
  //           name: '学术讲座管理',
  //           meta: { title: '学术讲座管理', icon: 'nested' }
  //         },
  //         {
  //           path: 'academic_lectures_check',
  //           component: () => import('@/views/academic_activities/academic_lectures/academic_lectures_check/index'),
  //           name: '学术讲座审核',
  //           meta: { title: '学术讲座审核', icon: 'nested', roles: ['校级审核员'] }
  //         }
  //       ]
  //     }
  //   ]
  // },
  {
    path: '/research_management',
    component: Layout,
    redirect: '/research_management/platform_management/platform_view',
    name: '科研管理',
    meta: {
      title: '科研管理',
      icon: 'nested'
    },
    children: [
      {
        path: 'platform_management',
        component: () => import('@/views/research_management/platform_management/index'),
        redirect: 'noRedirect',
        name: '科研平台管理',
        meta: { title: '科研平台管理', icon: 'nested' },
        children: [
          {
            path: 'platform_view',
            component: () => import('@/views/research_management/platform_management/platform_view/index'),
            name: '科研平台',
            meta: { title: '科研平台', icon: 'nested', roles: ['院级教师', '院级审核员', '校级审核员'] }
          },
          {
            path: 'platform_check2',
            component: () => import('@/views/research_management/platform_management/platform_check2/index'),
            name: '科研平台审核',
            meta: { title: '科研平台审核', icon: 'nested', roles: ['校级审核员'] }
          },
          {
            path: 'platform_check1',
            component: () => import('@/views/research_management/platform_management/platform_check1/index'),
            name: '科研平台审核',
            meta: { title: '科研平台审核', icon: 'nested', roles: ['院级审核员'] }
          }
        ]
      }
    ]
  },
  // {
  //   path: '/knowledge_sharing',
  //   component: Layout,
  //   redirect: '/knowledge_sharing/thesis_management/declaration_materials',
  //   name: '知识共享',
  //   meta: {
  //     title: '知识共享',
  //     icon: 'nested'
  //   },
  //   children: [
  //     {
  //       path: 'declaration_materials',
  //       component: () => import('@/views/knowledge_sharing/declaration_materials/index'),
  //       name: '申报材料',
  //       meta: { title: '申报材料', icon: 'nested' }
  //     },
  //     {
  //       path: 'research_briefs',
  //       component: () => import('@/views/knowledge_sharing/research_briefs/index'),
  //       name: '科研简报',
  //       meta: { title: '科研简报', icon: 'nested' }
  //     }
  //   ]
  // },
  {
    path: '/system',
    component: Layout,
    redirect: '/system/thesis_management/declaration_materials',
    name: '系统管理',
    meta: {
      title: '系统管理',
      icon: 'nested',
      roles: ['校级审核员']
    },
    children: [
      {
        path: 'user',
        component: () => import('@/views/system/user/index'),
        name: '用户管理',
        meta: { title: '用户管理', icon: 'nested', roles: ['隐藏'] }
      },
      {
        path: 'dept',
        component: () => import('@/views/system/dept/index'),
        name: '院系管理',
        meta: { title: '院系管理', icon: 'nested' }
      },
      // {
      //   path: 'projectCate',
      //   component: () => import('@/views/system/projectCate/index'),
      //   name: '纵向-项目类别',
      //   meta: { title: '纵向-项目类别', icon: 'nested' }
      // },
      {
        path: 'projectSourse',
        component: () => import('@/views/system/projectSourse/index'),
        name: '纵向-项目来源',
        meta: { title: '纵向-项目来源', icon: 'nested' }
      },
      {
        path: 'organizationForm',
        component: () => import('@/views/system/organizationForm/index'),
        name: '纵向-组织形式',
        meta: { title: '纵向-组织形式', icon: 'nested' }
      },
      {
        path: 'activityType',
        component: () => import('@/views/system/activityType/index'),
        name: '纵向-活动类型',
        meta: { title: '纵向-活动类型', icon: 'nested' }
      },
      {
        path: 'userManagement',
        component: () => import('@/views/system/userManagement/index'),
        name: '用户管理',
        meta: { title: '用户管理', icon: 'nested' }
      }
      // {
      //   path: 'disciplineClassfi',
      //   component: () => import('@/views/system/disciplineClassfi/index'),
      //   name: '纵向-学科分类',
      //   meta: { title: '纵向-学科分类', icon: 'nested' }
      // }
    ]
  },
  {
    path: '/discipline_building',
    component: Layout,
    redirect: '/discipline_building/discipline_management/platform_view',
    name: '学科建设',
    meta: {
      title: '学科建设',
      icon: 'nested',
      roles: ['隐藏']
    },
    children: [
      {
        path: 'discipline_management',
        component: () => import('@/views/discipline_building/discipline_management/index'),
        redirect: 'noRedirect',
        name: '学科建设管理',
        meta: { title: '学科建设管理', icon: 'nested' },
        children: [
          {
            path: 'discipline_view',
            component: () => import('@/views/discipline_building/discipline_management/discipline_view/index'),
            name: '学科建设查看',
            meta: { title: '学科建设', icon: 'nested' }
          },
          {
            path: 'discipline_check',
            component: () => import('@/views/discipline_building/discipline_management/discipline_check/index'),
            name: '学科建设审核',
            meta: { title: '学科建设审核', icon: 'nested', roles: ['校级审核员'] }
          }
        ]
      }
    ]
  },
  { path: '*', redirect: '/404', hidden: true }
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
